# Contributor: Taner Tas <taner76@gmail.com>
# Contributor: Dominika Liberda <ja@sdomi.pl>
# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=snes9x
pkgver=1.61
pkgrel=0
_glslang=bcf6a2430e99e8fc24f9f266e99316905e6d5134
_spirv=1458bae62ec67ea7d12c5a13b740e23ed4bb226c
pkgdesc="Super NES Emulator"
options="!check" # No testsuite
url="http://www.snes9x.com"
arch="all"
license="custom"
makedepends="
	alsa-lib-dev
	glib-dev
	gtk+3.0-dev
	gtkmm3-dev
	libepoxy-dev
	libpng-dev
	libxrandr-dev
	libxv-dev
	meson
	minizip-dev
	portaudio-dev
	sdl2-dev
	wayland-dev
	zlib-dev
	"
subpackages="$pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/snes9xgit/snes9x/archive/$pkgver.tar.gz
	glslang-$_glslang.tar.gz::https://github.com/KhronosGroup/glslang/archive/$_glslang.tar.gz
	spirv-$_spirv.tar.gz::https://github.com/KhronosGroup/SPIRV-Cross/archive/$_spirv.tar.gz
	"
builddir="$srcdir/$pkgname-$pkgver/gtk"

prepare() {
	default_prepare

	rm -r ../shaders/glslang ../shaders/SPIRV-Cross
	ln -s ../../glslang-$_glslang ../shaders/glslang
	ln -s ../../SPIRV-Cross-$_spirv ../shaders/SPIRV-Cross
}

build() {
	abuild-meson \
		-Dpulseaudio=false \
		. output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	ln -s snes9x-gtk "$pkgdir"/usr/bin/snes9x
}

sha512sums="
8b644f5b7136e89fd222bcb430fc736c74a3e383d7e6c7f0880235f6fa4c0f77abbf02493f8d654a12e87701111643e33877bc21bb3dfcc9b82a056fa1b1d880  snes9x-1.61.tar.gz
de2ebc0cd89d22582c079006ac45a812e3aaaad9a44c77c68530aa1468fbc840c6ae25a4356d4e9fc697524cd721d26506d85bc35eac98452eabce0bc098b5a4  glslang-bcf6a2430e99e8fc24f9f266e99316905e6d5134.tar.gz
bfa3cc944450db59a57a685eea12b0ed0b5059d55a092ac5cdf6f4dc03c1e2d2e62fa5a576156c772340e12136b10d7ed790bb35b4aece2ee8405e64f826e31b  spirv-1458bae62ec67ea7d12c5a13b740e23ed4bb226c.tar.gz
"
